find smallest and largest number